package com.example.kotlin.scrollingtable.java_type3;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.kotlin.scrollingtable.R;
import com.example.kotlin.scrollingtable.java_type3.model.JavaRvType3LeftAdapter;
import com.example.kotlin.scrollingtable.java_type3.model.JavaType3PriceModel;
import com.example.kotlin.scrollingtable.java_type3.model.JavaType3ProductModel;
import com.example.kotlin.scrollingtable.type3.RvType3LeftAdapter;
import com.example.kotlin.scrollingtable.type3.RvType3RightAdapter;
import com.example.kotlin.scrollingtable.type3.Type3Activity;

import org.jetbrains.annotations.NotNull;

import java.util.List;

import kotlin.jvm.internal.Intrinsics;

public class JavaType3Activity extends AppCompatActivity {

    private String TAG = Type3Activity.class.getName();
    private List mDataList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_java_type3);
        JavaRvType3LeftAdapter mLeftAdapter = new JavaRvType3LeftAdapter(R.layout.item_layout_type1,mDataList);
        JavaRvType3RightAdapter mRightAdapter = new JavaRvType3RightAdapter(R.layout.item_layout_type3,mDataList);
        int produceIndex = 10;

        for (byte var3 = 60; produceIndex <= var3; ++produceIndex) {
            JavaType3ProductModel productModel = new JavaType3ProductModel();
            productModel.setProductName("股票名称" + produceIndex);
            int priceIndex = 1;

            for (byte var6 = 5; priceIndex <= var6; ++priceIndex) {
                JavaType3PriceModel mainPriceModel = new JavaType3PriceModel();
                mainPriceModel.setPriceName("股票" + produceIndex + "价格-" + priceIndex);
                productModel.getmRightDataList().add(mainPriceModel);
            }

            this.mDataList.add(productModel);
        }

        JavaRvType3LeftAdapter var10000 = mLeftAdapter;

        var10000.setNewData(this.mDataList);
        RecyclerView var8 = (RecyclerView) this.findViewById(R.id.rv_list_left);
        Intrinsics.checkExpressionValueIsNotNull(var8, "rv_list_left");
        var8.setAdapter((RecyclerView.Adapter) mLeftAdapter);
        JavaRvType3RightAdapter var9 = mRightAdapter;

        var9.setNewData(this.mDataList);
        var8 = (RecyclerView) this.findViewById(R.id.rv_list_right);
        Intrinsics.checkExpressionValueIsNotNull(var8, "rv_list_right");
        var8.setAdapter((RecyclerView.Adapter) mRightAdapter);
        var10000 = mLeftAdapter;

        var10000.setMRvType3RightAdapter(mRightAdapter);
        var9 = mRightAdapter;

        var9.setMRvType3LeftAdapter(mLeftAdapter);
        var10000 = mLeftAdapter;
        var10000.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            public final void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Log.d(JavaType3Activity.this.TAG, "mLeftAdapter click position >> " + position);
            }
        });

        var9 = mRightAdapter;
        var9.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            public final void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Log.d(JavaType3Activity.this.TAG, "mRightAdapter click position >> " + position);
            }
        });

        ((RecyclerView) this.findViewById(R.id.rv_list_left)).addOnScrollListener((RecyclerView.OnScrollListener) (new RecyclerView.OnScrollListener() {
            public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
                Intrinsics.checkParameterIsNotNull(recyclerView, "recyclerView");
                if (recyclerView.getScrollState() != 0) {
                    ((RecyclerView) JavaType3Activity.this.findViewById(R.id.rv_list_right)).scrollBy(dx, dy);
                }

            }
        }));
        ((RecyclerView) this.findViewById(R.id.rv_list_right)).addOnScrollListener((RecyclerView.OnScrollListener) (new RecyclerView.OnScrollListener() {
            public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
                Intrinsics.checkParameterIsNotNull(recyclerView, "recyclerView");
                if (recyclerView.getScrollState() != 0) {
                    ((RecyclerView) JavaType3Activity.this.findViewById(R.id.rv_list_left)).scrollBy(dx, dy);
                }
            }
        }));
    }
}
